package com.java.mytools.controller;

import com.java.mytools.service.AutowiredAndResourceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.PrimitiveIterator;

/**
 * @author wangning
 * @create 2021-12-31 11:16
 */
@RestController
public class AutowiredAndResourceController {
	@Autowired
//	@Resource
	public AutowiredAndResourceService autowiredAndResourceService;
	//以下是通过set方法注入
//	private void setAutowiredAndResourceService(AutowiredAndResourceService autowiredAndResourceService) {
//		this.autowiredAndResourceService = autowiredAndResourceService;
//	}
	//以下是通过构造方法注入，属性可以定义为final，
//	private final AutowiredAndResourceService autowiredAndResourceService;

//	public AutowiredAndResourceController(@Qualifier("autowiredAndResourceServiceImpl") AutowiredAndResourceService autowiredAndResourceService) {
//		this.autowiredAndResourceService = autowiredAndResourceService;
//	}


	@GetMapping("/test")
	public String test() {
		autowiredAndResourceService.print();
		return "123456789";
	}
}
